package com.baidu.travel.timedtask.dao;

import com.baidu.travel.domain.Comment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentTimingDao extends BaseMapper<Comment> {

    /**
     * 将评论表中的路线id拿到
     * @return
     */
    @Select("select rid from tab_comment group by rid")
    Integer[] getCommentRid();


    @Select("select * from tab_comment c1 WHERE (select count(*) from tab_comment c2 WHERE c1.rid=c2.rid and c2.time>c1.time)<10 ORDER BY rid")
    List<Comment> getComments();
}
